/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package escom.ipn.modelo.delegate;
import escom.ipn.modelo.dto.CoordenadaPieTierraClass;
import escom.ipn.modelo.facade.CoordenadaRecursoFacade;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.List;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author omar moreno
 */
public class CoordenadaRecursoDelegate {
    private Connection cnn;
    private CoordenadaRecursoFacade af;
    
    
    public CoordenadaRecursoDelegate(){
        ResourceBundle recursos = ResourceBundle.getBundle("escom.ipn.Recursos.Recursos");
        String usuario=recursos.getString("user");
        String clave=recursos.getString("pass");
        String url=recursos.getString("url");
        String driver=recursos.getString("driver");
        try{
            Class.forName(driver);
            cnn = DriverManager.
                    getConnection(url,usuario,clave);
        }catch(Exception e){
            e.printStackTrace();
        }
        af=new CoordenadaRecursoFacade(cnn);
    }
    
    public List mostrar(CoordenadaPieTierraClass a)
            throws SQLException{
        return af.leerCoordenadaRecurso(a);
    }
    public List mostrarCoordenadas(CoordenadaPieTierraClass a)
    throws SQLException {
        return af.mostrarCoordenadas(a,cnn);
    }
    
    public List mostrarCoordenadasPatrullas(CoordenadaPieTierraClass a)
    throws SQLException {
        return af.mostrarPatrullas(a,cnn);
    }
    
    public List mostrarPatrulla(CoordenadaPieTierraClass a)
            throws SQLException{
        return af.leerCoordenadaPatrulla(a);
    }
}
